// 引入路由组件
import Home from '@/pages/Home'
import Search from '@/pages/Search'
import Login from '@/pages/Login'
import Register from '@/pages/Register'
import Detail from '@/pages/Detail'
import AddCartSuccess from '@/pages/AddCartSuccess'
import ShopCart from '@/pages/ShopCart'
import Trade from '@/pages/Trade'
export default [
    // 首页路由
    {
        path: '/home',
        component: Home,
        // 路由元信息控制显示与隐藏
        meta: {
            show: true
        },
    },
    // 搜索页路由
    {
        name: 'search',
        // 路由传参 --params参数占位
        path: '/search/:keyWord?',
        component: Search,
        meta: {
            show: true
        },
    },
    // 登录路由
    {
        path: '/login',
        component: Login,
        meta: {
            show: false
        },
    },
    // 注册路由
    {
        path: '/register',
        component: Register,
        meta: {
            show: false
        },
    },
    // 详情页路由 --params参数占位
    {
        path: '/detail/:skuId',
        component: Detail,
        meta: {
            show: true
        },
    },
    // 加入购物车路由 --query参数不用占位
    {
        name:'addcartsuccess',
        path: '/addcartsuccess/',
        component: AddCartSuccess,
        meta: {
            show: true
        }
    },
    // 跳转购物车页面路由
    {
        path:'/shopcart',
        component: ShopCart,
        meta: {
            show: true
        }
    },
    {
        path:'/trade',
        component: Trade,
        meta: {
            show: true
        }
    },
    // 添加一个重定向  默认为Home组件
    {
        path: '/',
        redirect: '/home'
    }
]